package com.ruoyi.mall.app.service.impl;

import com.ruoyi.mall.app.service.DtsRegionService;
import com.ruoyi.mall.common.domain.DtsRegion;
import com.ruoyi.mall.common.mapper.DtsRegionMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class DtsRegionServiceImpl implements DtsRegionService {

    @Autowired
    private DtsRegionMapper dtsRegionMapper;

    @Override
    public List<DtsRegion> getProvinces() {
        return dtsRegionMapper.selectRegionByType(1);
    }

    @Override
    public List<DtsRegion> getCitiesByProvince(Long provinceId) {
        return dtsRegionMapper.selectRegionByPidAndType(provinceId, 2);
    }

    @Override
    public List<DtsRegion> getDistrictsByCity(Long cityId) {
        return dtsRegionMapper.selectRegionByPidAndType(cityId, 3);
    }
}
